<?php
include_once "checkAdmin.php";
?>
<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
<?php
$id = $_GET['id'];
include_once "conn.php";
$sql = "select * from object where id = '$id'";
$result = mysqli_query($conn,$sql);
if(mysqli_num_rows($result) == 0){
    echo "<script>alert('此对象未找到');history.back();</script>";
    exit;
}
$info = mysqli_fetch_array($result);
?>
<h1 class="title">后台管理</h1>
<form action="postModify.php" method="post" enctype="multipart/form-data">
    <table cellpadding="15" border="1" width="100%" bordercolor="black" style="border-collapse: collapse">
        <tr>
            <td align="right">对象名称</td>
            <td><input name="name" value="<?php echo $info['name'];?>"></td>
        </tr>
        <tr>
            <td align="right">对象介绍</td>
            <td><textarea name="description"><?php echo $info['description'];?></textarea></td>
        </tr>
        <tr>
            <td align="right">对象图片</td>
            <td><input type="file" name="pic"><input type="hidden" name="MAX_FILE_SIZE" value="2000000"><input type="hidden" name="id" value="<?php echo $id;?>"> </td>
        </tr>
        <tr>
            <td align="right"><input type="submit" value="提交"></td>
            <td><input type="reset" value="重置"></td>
        </tr>
    </table>
</form>
</body>
</html>